package org.BUPT.domain.service.impl;

import org.BUPT.domain.service.CommentService;
import org.BUPT.infrastructure.persistent.DAO.CommentDAO;
import org.BUPT.infrastructure.persistent.po.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


import java.util.List;
@Component

public class CommentServiceImpl implements CommentService {
    @Autowired
    CommentDAO commentDAO;
    public Comment getComment(int commentId){
        return commentDAO.findCommentByCommentIdAndIsDel(commentId,0);
    }
    public List<Comment> getCommentsOfComment(int commentId){
        return commentDAO.findAllByParentIdAndIsDel(commentId,0);
    }
    public Comment saveComment(Comment comment){
        return commentDAO.save(comment);    }

}
